package com.whjz.dcfs.jzxx.struts.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.whjz.dcfs.jzxx.dao.IDcfsSbTxxsJbxxDAO;
import com.whjz.dcfs.jzxx.model.DcfsSbTxxsJbxx;
import com.whjz.dcfs.util.BaseAction;

public class JZSBTXXSAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	
	@Autowired
	public IDcfsSbTxxsJbxxDAO dcfsSbTxxsJbxxDAO;

	private DcfsSbTxxsJbxx dcfsSbTxxsJbxx;

	public DcfsSbTxxsJbxx getDcfsSbTxxsJbxx() {
		return dcfsSbTxxsJbxx;
	}

	public void setDcfsSbTxxsJbxx(DcfsSbTxxsJbxx dcfsSbTxxsJbxx) {
		this.dcfsSbTxxsJbxx = dcfsSbTxxsJbxx;
	}
	
	public void getDcfsSbTxxsJbxxListByCond() throws Exception{
		try{
			getHttpServletResponse().setCharacterEncoding("utf-8");
			List<DcfsSbTxxsJbxx> list=dcfsSbTxxsJbxxDAO.getDcfsSbTxxsJbxxListByCond(dcfsSbTxxsJbxx);
			StringBuffer sb=new StringBuffer();
			sb.append("{root:[");
	        if(list!=null&&list.size()>0){
		         for(int i=0;i<list.size();i++){
		        	 sb.append("{");
		        	 sb.append("TXXS_BH:'"+list.get(i).getTxxsbh()+"',");
		        	 sb.append("TXXS_MC:'"+list.get(i).getTxxsmc()+"'");
		        	 sb.append("}");
		        	 if(i < list.size()-1){
		        		 sb.append(",");
		        	 }
		         }
		
	        }
            sb.append("]}");
            getHttpServletResponse().getWriter().print(sb);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
